package com.buer.storage.utils;

import java.io.ByteArrayOutputStream;
import java.io.InputStream;

/**
 * Created by Administrator on 2021/2/5.
 */
public class DownLoadUtils {
    public static byte[] InputStream2byte(InputStream inputStream) {
        byte[] buffer=null;
        try (InputStream fis = inputStream;
             ByteArrayOutputStream bos = new ByteArrayOutputStream()){
            byte[] b = new byte[1024];
            int n;
            while ((n = fis.read(b)) != -1)
            {
                bos.write(b, 0, n);
            }
            buffer = bos.toByteArray();

        }catch (Exception e){
           e.printStackTrace();
        }
        return buffer;
    }
}



